

package com.arcsoft.api.base.util;

import io.swagger.v3.oas.annotations.media.Schema;
import java.io.Serializable;
import java.util.Objects;

public class ResponseResult<T> implements Serializable {
    @Schema(
        description = "状态码"
    )
    private int code;
    @Schema(
        description = "消息"
    )
    private String message;
    @Schema(
        description = "返回数据"
    )
    private T data;

    public <T> ResponseResult() {
    }

    public ResponseResult(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public int getCode() {
        return this.code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T> ResponseResult<T> success() {
        return new ResponseResult(200, "Success", (Object)null);
    }

    public static <T> ResponseResult<T> success(T data) {
        return new ResponseResult(200, "Success", data);
    }

    public static <T> ResponseResult<T> success(String message, T data) {
        return new ResponseResult(200, message, data);
    }

    public static <T> ResponseResult<T> error(T data, String message) {
        return new ResponseResult(500, message, data);
    }

    public static <T> ResponseResult<T> error(T data, String message, int code) {
        return new ResponseResult(code, message, data);
    }

    public static <T> ResponseResult<T> error() {
        return new ResponseResult(500, "fail", (Object)null);
    }

    public static <T> ResponseResult<T> error(String message, int code) {
        return new ResponseResult(code, message, (Object)null);
    }

    public static <T> ResponseResult<T> error(String message) {
        return new ResponseResult(500, message, (Object)null);
    }

    @Override
    public String toString() {
        return "ResponseResult{code=" + this.code + ", message='" + this.message + '\'' + ", data=" + this.data + '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o != null && this.getClass() == o.getClass()) {
            ResponseResult<?> that = (ResponseResult)o;
            return this.code == that.code && Objects.equals(this.message, that.message) && Objects.equals(this.data, that.data);
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return Objects.hash(new Object[]{this.code, this.message, this.data});
    }
}
